{
 "cells": [
  {
   "cell_type": "code",
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:16:50.456037Z",
     "start_time": "2024-09-19T09:16:50.450867Z"
    }
   },
   "id": "955def2dff9332a5",
   "outputs": [],
   "execution_count": 103
  },
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:16:50.634604Z",
     "start_time": "2024-09-19T09:16:50.561055Z"
    }
   },
   "source": [
    "user_info = pd.read_csv(r'D:\\pcdaima\\shixun\\shixun1\\data\\fugou\\user_info_format1.csv')\n",
    "user_info.head()"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "   user_id  age_range  gender\n",
       "0   376517        6.0     1.0\n",
       "1   234512        5.0     0.0\n",
       "2   344532        5.0     0.0\n",
       "3   186135        5.0     0.0\n",
       "4    30230        5.0     0.0"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>age_range</th>\n",
       "      <th>gender</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>376517</td>\n",
       "      <td>6.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>234512</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>344532</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>186135</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>30230</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 104,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 104
  },
  {
   "cell_type": "code",
   "source": [
    "user_log = pd.read_csv(r'D:\\pcdaima\\shixun\\shixun1\\data\\fugou\\user_log_format1.csv')\n",
    "user_log.head()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:07.445625Z",
     "start_time": "2024-09-19T09:16:50.711616Z"
    }
   },
   "id": "2c525cb895b58ac5",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "   user_id  item_id  cat_id  seller_id  brand_id  time_stamp  action_type\n",
       "0   328862   323294     833       2882    2661.0         829            0\n",
       "1   328862   844400    1271       2882    2661.0         829            0\n",
       "2   328862   575153    1271       2882    2661.0         829            0\n",
       "3   328862   996875    1271       2882    2661.0         829            0\n",
       "4   328862  1086186    1271       1253    1049.0         829            0"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>item_id</th>\n",
       "      <th>cat_id</th>\n",
       "      <th>seller_id</th>\n",
       "      <th>brand_id</th>\n",
       "      <th>time_stamp</th>\n",
       "      <th>action_type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>328862</td>\n",
       "      <td>323294</td>\n",
       "      <td>833</td>\n",
       "      <td>2882</td>\n",
       "      <td>2661.0</td>\n",
       "      <td>829</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>328862</td>\n",
       "      <td>844400</td>\n",
       "      <td>1271</td>\n",
       "      <td>2882</td>\n",
       "      <td>2661.0</td>\n",
       "      <td>829</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>328862</td>\n",
       "      <td>575153</td>\n",
       "      <td>1271</td>\n",
       "      <td>2882</td>\n",
       "      <td>2661.0</td>\n",
       "      <td>829</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>328862</td>\n",
       "      <td>996875</td>\n",
       "      <td>1271</td>\n",
       "      <td>2882</td>\n",
       "      <td>2661.0</td>\n",
       "      <td>829</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>328862</td>\n",
       "      <td>1086186</td>\n",
       "      <td>1271</td>\n",
       "      <td>1253</td>\n",
       "      <td>1049.0</td>\n",
       "      <td>829</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 105,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 105
  },
  {
   "cell_type": "code",
   "source": [
    "user_info.isnull().sum()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:07.454142Z",
     "start_time": "2024-09-19T09:17:07.446621Z"
    }
   },
   "id": "2e9d2aa998b4b3b9",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "user_id         0\n",
       "age_range    2217\n",
       "gender       6436\n",
       "dtype: int64"
      ]
     },
     "execution_count": 106,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 106
  },
  {
   "cell_type": "code",
   "source": [
    "user_log.isnull().sum()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:07.878235Z",
     "start_time": "2024-09-19T09:17:07.455136Z"
    }
   },
   "id": "b52a126a0523a131",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "user_id            0\n",
       "item_id            0\n",
       "cat_id             0\n",
       "seller_id          0\n",
       "brand_id       91015\n",
       "time_stamp         0\n",
       "action_type        0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 107,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 107
  },
  {
   "cell_type": "code",
   "source": [
    "user_info.info()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:07.888540Z",
     "start_time": "2024-09-19T09:17:07.879232Z"
    }
   },
   "id": "7dffd89587d5fc0f",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 424170 entries, 0 to 424169\n",
      "Data columns (total 3 columns):\n",
      " #   Column     Non-Null Count   Dtype  \n",
      "---  ------     --------------   -----  \n",
      " 0   user_id    424170 non-null  int64  \n",
      " 1   age_range  421953 non-null  float64\n",
      " 2   gender     417734 non-null  float64\n",
      "dtypes: float64(2), int64(1)\n",
      "memory usage: 9.7 MB\n"
     ]
    }
   ],
   "execution_count": 108
  },
  {
   "cell_type": "code",
   "source": [
    "user_log.info()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:07.896070Z",
     "start_time": "2024-09-19T09:17:07.889536Z"
    }
   },
   "id": "a57b928566bc0c2e",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 54925330 entries, 0 to 54925329\n",
      "Data columns (total 7 columns):\n",
      " #   Column       Dtype  \n",
      "---  ------       -----  \n",
      " 0   user_id      int64  \n",
      " 1   item_id      int64  \n",
      " 2   cat_id       int64  \n",
      " 3   seller_id    int64  \n",
      " 4   brand_id     float64\n",
      " 5   time_stamp   int64  \n",
      " 6   action_type  int64  \n",
      "dtypes: float64(1), int64(6)\n",
      "memory usage: 2.9 GB\n"
     ]
    }
   ],
   "execution_count": 109
  },
  {
   "cell_type": "code",
   "source": [
    "user_log.shape"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:07.904576Z",
     "start_time": "2024-09-19T09:17:07.897065Z"
    }
   },
   "id": "78ef6fdac1a8b2ed",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(54925330, 7)"
      ]
     },
     "execution_count": 110,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 110
  },
  {
   "cell_type": "code",
   "source": [
    "# 去除空值\n",
    "user_info['age_range'].replace(np.nan,2,inplace=True) # 2和NULL表示未知\n",
    "user_info['gender'].replace(np.nan,-1,inplace=True)\n",
    "user_info.isnull().sum()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:07.919322Z",
     "start_time": "2024-09-19T09:17:07.905574Z"
    }
   },
   "id": "fb4b8f869391b193",
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\pwx\\AppData\\Local\\Temp\\ipykernel_8864\\1355905500.py:2: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.\n",
      "The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.\n",
      "\n",
      "For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.\n",
      "\n",
      "\n",
      "  user_info['age_range'].replace(np.nan,2,inplace=True) # 2和NULL表示未知\n",
      "C:\\Users\\pwx\\AppData\\Local\\Temp\\ipykernel_8864\\1355905500.py:3: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.\n",
      "The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.\n",
      "\n",
      "For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.\n",
      "\n",
      "\n",
      "  user_info['gender'].replace(np.nan,-1,inplace=True)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "user_id      0\n",
       "age_range    0\n",
       "gender       0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 111,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 111
  },
  {
   "cell_type": "code",
   "source": [
    "user_log['brand_id'].replace(np.nan,-1,inplace=True)\n",
    "user_log.isnull().sum()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:08.445748Z",
     "start_time": "2024-09-19T09:17:07.920317Z"
    }
   },
   "id": "26c9ebd5dccdc3c3",
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\pwx\\AppData\\Local\\Temp\\ipykernel_8864\\1715364757.py:1: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.\n",
      "The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.\n",
      "\n",
      "For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.\n",
      "\n",
      "\n",
      "  user_log['brand_id'].replace(np.nan,-1,inplace=True)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "user_id        0\n",
       "item_id        0\n",
       "cat_id         0\n",
       "seller_id      0\n",
       "brand_id       0\n",
       "time_stamp     0\n",
       "action_type    0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 112,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 112
  },
  {
   "cell_type": "code",
   "source": [
    "print(user_info.duplicated().sum())\n",
    "print(user_log.duplicated().sum())"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:26.857773Z",
     "start_time": "2024-09-19T09:17:08.446747Z"
    }
   },
   "id": "b05a9703db44e02a",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "13750198\n"
     ]
    }
   ],
   "execution_count": 113
  },
  {
   "cell_type": "code",
   "source": [
    "user_log.drop_duplicates(inplace=True)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:46.443982Z",
     "start_time": "2024-09-19T09:17:26.858773Z"
    }
   },
   "id": "ea2c96927e2f314b",
   "outputs": [],
   "execution_count": 114
  },
  {
   "cell_type": "code",
   "source": [
    "train = pd.read_csv(r'D:\\pcdaima\\shixun\\shixun1\\data\\fugou\\train_format1.csv')\n",
    "train.head()\n",
    "# test_data.head()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:46.497434Z",
     "start_time": "2024-09-19T09:17:46.444976Z"
    }
   },
   "id": "75111d5dd5f7e736",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "   user_id  merchant_id  label\n",
       "0    34176         3906      0\n",
       "1    34176          121      0\n",
       "2    34176         4356      1\n",
       "3    34176         2217      0\n",
       "4   230784         4818      0"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>merchant_id</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>34176</td>\n",
       "      <td>3906</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>34176</td>\n",
       "      <td>121</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>34176</td>\n",
       "      <td>4356</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>34176</td>\n",
       "      <td>2217</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>230784</td>\n",
       "      <td>4818</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 115,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 115
  },
  {
   "cell_type": "code",
   "source": [
    "df_train = pd.merge(train,user_info, on='user_id')\n",
    "df_train.head(20)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:46.565371Z",
     "start_time": "2024-09-19T09:17:46.498428Z"
    }
   },
   "id": "216f675c529a3679",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "    user_id  merchant_id  label  age_range  gender\n",
       "0     34176         3906      0        6.0     0.0\n",
       "1     34176          121      0        6.0     0.0\n",
       "2     34176         4356      1        6.0     0.0\n",
       "3     34176         2217      0        6.0     0.0\n",
       "4    230784         4818      0        0.0     0.0\n",
       "5    362112         2618      0        4.0     1.0\n",
       "6     34944         2051      0        5.0     0.0\n",
       "7    231552         3828      1        5.0     0.0\n",
       "8    231552         2124      0        5.0     0.0\n",
       "9    232320         1168      0        4.0     1.0\n",
       "10   232320         4270      0        4.0     1.0\n",
       "11   167040          671      0        5.0     0.0\n",
       "12   101760         1760      0        0.0     0.0\n",
       "13   298368         2981      0        4.0     0.0\n",
       "14    36480         4730      0        6.0     1.0\n",
       "15   299136         2935      0        0.0     0.0\n",
       "16    37248         2615      0        3.0     1.0\n",
       "17   103296         2482      0        6.0     0.0\n",
       "18   299904         1742      0        6.0     1.0\n",
       "19    38016         1028      0        3.0     0.0"
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>merchant_id</th>\n",
       "      <th>label</th>\n",
       "      <th>age_range</th>\n",
       "      <th>gender</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>34176</td>\n",
       "      <td>3906</td>\n",
       "      <td>0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>34176</td>\n",
       "      <td>121</td>\n",
       "      <td>0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>34176</td>\n",
       "      <td>4356</td>\n",
       "      <td>1</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>34176</td>\n",
       "      <td>2217</td>\n",
       "      <td>0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>230784</td>\n",
       "      <td>4818</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>362112</td>\n",
       "      <td>2618</td>\n",
       "      <td>0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>34944</td>\n",
       "      <td>2051</td>\n",
       "      <td>0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>231552</td>\n",
       "      <td>3828</td>\n",
       "      <td>1</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>231552</td>\n",
       "      <td>2124</td>\n",
       "      <td>0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>232320</td>\n",
       "      <td>1168</td>\n",
       "      <td>0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>232320</td>\n",
       "      <td>4270</td>\n",
       "      <td>0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>167040</td>\n",
       "      <td>671</td>\n",
       "      <td>0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>101760</td>\n",
       "      <td>1760</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>298368</td>\n",
       "      <td>2981</td>\n",
       "      <td>0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>36480</td>\n",
       "      <td>4730</td>\n",
       "      <td>0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>299136</td>\n",
       "      <td>2935</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>37248</td>\n",
       "      <td>2615</td>\n",
       "      <td>0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>103296</td>\n",
       "      <td>2482</td>\n",
       "      <td>0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>299904</td>\n",
       "      <td>1742</td>\n",
       "      <td>0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>38016</td>\n",
       "      <td>1028</td>\n",
       "      <td>0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 116,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 116
  },
  {
   "cell_type": "code",
   "source": [
    "user_log.rename(columns={'seller_id':'merchant_id'},inplace=True)\n",
    "df_train = pd.merge(df_train,user_log,on=['user_id','merchant_id'],how='left')\n",
    "df_train.head()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:51.948773Z",
     "start_time": "2024-09-19T09:17:46.566367Z"
    }
   },
   "id": "f55104e9f1c1a701",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "   user_id  merchant_id  label  age_range  gender  item_id  cat_id  brand_id  \\\n",
       "0    34176         3906      0        6.0     0.0   757713     821    6268.0   \n",
       "1    34176         3906      0        6.0     0.0   718096    1142    6268.0   \n",
       "2    34176         3906      0        6.0     0.0   757713     821    6268.0   \n",
       "3    34176         3906      0        6.0     0.0   613698     821    6268.0   \n",
       "4    34176         3906      0        6.0     0.0   757713     821    6268.0   \n",
       "\n",
       "   time_stamp  action_type  \n",
       "0        1110            0  \n",
       "1        1031            3  \n",
       "2        1031            3  \n",
       "3        1021            0  \n",
       "4        1108            0  "
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>merchant_id</th>\n",
       "      <th>label</th>\n",
       "      <th>age_range</th>\n",
       "      <th>gender</th>\n",
       "      <th>item_id</th>\n",
       "      <th>cat_id</th>\n",
       "      <th>brand_id</th>\n",
       "      <th>time_stamp</th>\n",
       "      <th>action_type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>34176</td>\n",
       "      <td>3906</td>\n",
       "      <td>0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>757713</td>\n",
       "      <td>821</td>\n",
       "      <td>6268.0</td>\n",
       "      <td>1110</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>34176</td>\n",
       "      <td>3906</td>\n",
       "      <td>0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>718096</td>\n",
       "      <td>1142</td>\n",
       "      <td>6268.0</td>\n",
       "      <td>1031</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>34176</td>\n",
       "      <td>3906</td>\n",
       "      <td>0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>757713</td>\n",
       "      <td>821</td>\n",
       "      <td>6268.0</td>\n",
       "      <td>1031</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>34176</td>\n",
       "      <td>3906</td>\n",
       "      <td>0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>613698</td>\n",
       "      <td>821</td>\n",
       "      <td>6268.0</td>\n",
       "      <td>1021</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>34176</td>\n",
       "      <td>3906</td>\n",
       "      <td>0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>757713</td>\n",
       "      <td>821</td>\n",
       "      <td>6268.0</td>\n",
       "      <td>1108</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 117,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 117
  },
  {
   "cell_type": "code",
   "source": [
    "test = pd.read_csv(r'D:\\pcdaima\\shixun\\shixun1\\data\\fugou\\test_format1.csv')\n",
    "df_test = pd.merge(test,user_info, on='user_id')\n",
    "df_test = pd.merge(df_test,user_log,on=['user_id','merchant_id'],how='left')\n",
    "df_test.head()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:17:57.355193Z",
     "start_time": "2024-09-19T09:17:51.950768Z"
    }
   },
   "id": "5a27192fcc08ec0a",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "   user_id  merchant_id  prob  age_range  gender  item_id  cat_id  brand_id  \\\n",
       "0   163968         4605   NaN        0.0     0.0   772645    1368    7622.0   \n",
       "1   163968         4605   NaN        0.0     0.0   772645    1368    7622.0   \n",
       "2   360576         1581   NaN        2.0     2.0   948181     614    4066.0   \n",
       "3   360576         1581   NaN        2.0     2.0  1111020     614    4066.0   \n",
       "4   360576         1581   NaN        2.0     2.0   294442     614    4066.0   \n",
       "\n",
       "   time_stamp  action_type  \n",
       "0        1111            2  \n",
       "1        1111            0  \n",
       "2        1111            2  \n",
       "3        1111            2  \n",
       "4        1111            2  "
      ],
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>merchant_id</th>\n",
       "      <th>prob</th>\n",
       "      <th>age_range</th>\n",
       "      <th>gender</th>\n",
       "      <th>item_id</th>\n",
       "      <th>cat_id</th>\n",
       "      <th>brand_id</th>\n",
       "      <th>time_stamp</th>\n",
       "      <th>action_type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>163968</td>\n",
       "      <td>4605</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>772645</td>\n",
       "      <td>1368</td>\n",
       "      <td>7622.0</td>\n",
       "      <td>1111</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>163968</td>\n",
       "      <td>4605</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>772645</td>\n",
       "      <td>1368</td>\n",
       "      <td>7622.0</td>\n",
       "      <td>1111</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>360576</td>\n",
       "      <td>1581</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>948181</td>\n",
       "      <td>614</td>\n",
       "      <td>4066.0</td>\n",
       "      <td>1111</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>360576</td>\n",
       "      <td>1581</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1111020</td>\n",
       "      <td>614</td>\n",
       "      <td>4066.0</td>\n",
       "      <td>1111</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>360576</td>\n",
       "      <td>1581</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>294442</td>\n",
       "      <td>614</td>\n",
       "      <td>4066.0</td>\n",
       "      <td>1111</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ]
     },
     "execution_count": 118,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 118
  },
  {
   "cell_type": "code",
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "X = df_train.drop('label',axis=1)\n",
    "y = df_train['label']\n",
    "X_train,X_val,y_train,y_val = train_test_split(X, y, test_size=0.7, random_state=42)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T11:10:09.324575Z",
     "start_time": "2024-09-19T11:10:09.023067Z"
    }
   },
   "id": "231aba80b2fab444",
   "outputs": [],
   "execution_count": 142
  },
  {
   "cell_type": "code",
   "source": [
    "from sklearn.ensemble import RandomForestClassifier\n",
    "from sklearn.metrics import classification_report\n",
    "\n",
    "model = RandomForestClassifier(max_depth=2, random_state=0)\n",
    "model.fit(X_train,y_train)\n",
    "y_pred=model.predict(X_val)\n",
    "y_proba = model.predict_proba(X_val)\n",
    "print('模型的评估报告：\\n',classification_report(y_val, y_pred))\n"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T11:10:33.289404Z",
     "start_time": "2024-09-19T11:10:11.480432Z"
    }
   },
   "id": "a1d1ebf5db12cef1",
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\ANACONDA\\Lib\\site-packages\\sklearn\\metrics\\_classification.py:1517: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
      "  _warn_prf(average, modifier, f\"{metric.capitalize()} is\", len(result))\n",
      "D:\\ANACONDA\\Lib\\site-packages\\sklearn\\metrics\\_classification.py:1517: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
      "  _warn_prf(average, modifier, f\"{metric.capitalize()} is\", len(result))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "模型的评估报告：\n",
      "               precision    recall  f1-score   support\n",
      "\n",
      "           0       0.90      1.00      0.95   1120013\n",
      "           1       0.00      0.00      0.00    124900\n",
      "\n",
      "    accuracy                           0.90   1244913\n",
      "   macro avg       0.45      0.50      0.47   1244913\n",
      "weighted avg       0.81      0.90      0.85   1244913\n",
      "\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\ANACONDA\\Lib\\site-packages\\sklearn\\metrics\\_classification.py:1517: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 in labels with no predicted samples. Use `zero_division` parameter to control this behavior.\n",
      "  _warn_prf(average, modifier, f\"{metric.capitalize()} is\", len(result))\n"
     ]
    }
   ],
   "execution_count": 143
  },
  {
   "cell_type": "code",
   "source": [
    "from sklearn.metrics import roc_auc_score\n",
    "from sklearn.metrics import accuracy_score\n",
    "auc=roc_auc_score(y_val,y_pred)\n",
    "auc"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T11:10:39.523693Z",
     "start_time": "2024-09-19T11:10:39.383179Z"
    }
   },
   "id": "1e6306d7c8941307",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.5"
      ]
     },
     "execution_count": 144,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 144
  },
  {
   "cell_type": "code",
   "source": [
    "model1 = RandomForestClassifier(max_depth=10, random_state=0,class_weight='balanced')\n",
    "model1.fit(X_train,y_train)\n",
    "y_pred1=model1.predict(X_val)\n",
    "y_proba1 = model1.predict_proba(X_val)\n",
    "print('模型的评估报告：\\n',classification_report(y_val, y_pred1))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T11:11:56.125793Z",
     "start_time": "2024-09-19T11:10:42.427016Z"
    }
   },
   "id": "d678f0a05dc415b3",
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "模型的评估报告：\n",
      "               precision    recall  f1-score   support\n",
      "\n",
      "           0       0.93      0.79      0.85   1120013\n",
      "           1       0.21      0.50      0.29    124900\n",
      "\n",
      "    accuracy                           0.76   1244913\n",
      "   macro avg       0.57      0.64      0.57   1244913\n",
      "weighted avg       0.86      0.76      0.80   1244913\n",
      "\n"
     ]
    }
   ],
   "execution_count": 145
  },
  {
   "cell_type": "code",
   "source": [
    "auc1 = roc_auc_score(y_val,y_pred1)\n",
    "auc1"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T11:12:01.026474Z",
     "start_time": "2024-09-19T11:12:00.835330Z"
    }
   },
   "id": "afc91b7279bb790f",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.6407718478765198"
      ]
     },
     "execution_count": 146,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 146
  },
  {
   "cell_type": "code",
   "source": [
    "X_test = df_test.drop('prob',axis=1)\n",
    "\n",
    "y_predict = model1.predict(X_val)\n",
    "accuracy = accuracy_score(y_val,y_predict)\n",
    "accuracy"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-09-19T09:19:43.578881Z",
     "start_time": "2024-09-19T09:19:36.804643Z"
    }
   },
   "id": "2413f997a26ec5ba",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.7564456311404893"
      ]
     },
     "execution_count": 124,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 124
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-19T11:12:36.967594Z",
     "start_time": "2024-09-19T11:12:07.843310Z"
    }
   },
   "cell_type": "code",
   "source": [
    "import xgboost as xgb\n",
    "from sklearn.metrics import accuracy_score\n",
    "model = xgb.XGBClassifier(\n",
    "    max_depth=8,\n",
    "    n_estimators=2000,\n",
    "    min_child_weight=300, \n",
    "    colsample_bytree=0.8, \n",
    "    subsample=0.8, \n",
    "    eta=0.3,    \n",
    "    seed=42   \n",
    ")\n",
    "model.fit(X_train,y_train)\n",
    "xgb_pred = model.predict(X_val)\n",
    "accuracy = accuracy_score(y_val,xgb_pred)\n",
    "auc1 = roc_auc_score(y_val,xgb_pred)\n",
    "# from sklearn2pmml import sklearn2pmml\n",
    "# sklearn2pmml(model,'xgb.pmml')\n",
    "auc1 "
   ],
   "id": "f1b2d19bc4d6b996",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.6013303891638103"
      ]
     },
     "execution_count": 147,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 147
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-19T11:24:25.660354Z",
     "start_time": "2024-09-19T11:24:18.337561Z"
    }
   },
   "cell_type": "code",
   "source": [
    "from sklearn.tree import DecisionTreeClassifier\n",
    "decision_model = DecisionTreeClassifier()\n",
    "decision_model.fit(X_train,y_train)\n",
    "decision_pred = model.predict(X_val)\n",
    "auc1 = roc_auc_score(y_val,decision_pred)\n",
    "from sklearn2pmml import sklearn2pmml\n",
    "sklearn2pmml(decision_model,'decision.pmml')\n",
    "auc1 \n",
    "\n",
    "\n"
   ],
   "id": "f12f8aa3a8be1c1b",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.7828607995998206"
      ]
     },
     "execution_count": 153,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 153
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-19T11:27:48.793301Z",
     "start_time": "2024-09-19T11:27:48.788456Z"
    }
   },
   "cell_type": "code",
   "source": "",
   "id": "16dad8cfa08b149d",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "86283      0\n",
       "750383     0\n",
       "618816     1\n",
       "558861     0\n",
       "851284     0\n",
       "          ..\n",
       "1282680    0\n",
       "592722     0\n",
       "674077     0\n",
       "943701     0\n",
       "347119     0\n",
       "Name: label, Length: 1244913, dtype: int64"
      ]
     },
     "execution_count": 158,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 158
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-19T11:03:26.629063Z",
     "start_time": "2024-09-19T11:03:22.790201Z"
    }
   },
   "cell_type": "code",
   "source": [
    "from sklearn.feature_selection import SelectKBest\n",
    "best = SelectKBest(k=5)\n",
    "X_new = best.fit_transform(X,y)\n",
    "X_train,X_test,y_train,y_test = train_test_split(X_new,y,train_size=0.8,random_state=42)\n",
    "model = xgb.XGBClassifier()\n",
    "model.fit(X_train,y_train)\n",
    "xgb_pred = model.predict(X_test)\n",
    "auc1 = roc_auc_score(y_test,xgb_pred)\n",
    "auc1\n"
   ],
   "id": "a4d94b02d80968ae",
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\ANACONDA\\Lib\\site-packages\\xgboost\\core.py:158: UserWarning: [19:03:23] WARNING: C:\\buildkite-agent\\builds\\buildkite-windows-cpu-autoscaling-group-i-06abd128ca6c1688d-1\\xgboost\\xgboost-ci-windows\\src\\learner.cc:740: \n",
      "Parameters: { \"class_weight\" } are not used.\n",
      "\n",
      "  warnings.warn(smsg, UserWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.5213820416803686"
      ]
     },
     "execution_count": 138,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 138
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-09-19T11:09:08.304041Z",
     "start_time": "2024-09-19T11:07:21.171966Z"
    }
   },
   "cell_type": "code",
   "source": [
    "model1 = RandomForestClassifier(max_depth=10, random_state=0,class_weight='balanced')\n",
    "model1.fit(X_train,y_train)\n",
    "y_pred1=model1.predict(X_test)\n",
    "y_proba1 = model1.predict_proba(X_test)\n",
    "# print('模型的评估报告：\\n',classification_report(y_test, y_pred1))\n",
    "auc1 = roc_auc_score(y_test,y_pred1)\n",
    "auc1"
   ],
   "id": "721692607a3fac85",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.6142156700204122"
      ]
     },
     "execution_count": 141,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 141
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
